﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="AverageRatings.aspx.vb" Inherits="APhones2.AverageRatings" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            font-size: xx-large;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        <strong>
        <br />
        <span class="style1">Users Average Phone Ratings</span></strong></p>
    <p>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="PhoneName" HeaderText="PhoneName" 
                    SortExpression="PhoneName" />
                <asp:BoundField DataField="AvgOfRating" HeaderText="Average number of rates" 
                    ReadOnly="True" SortExpression="AvgOfRating" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:Phones %>" 
            ProviderName="<%$ ConnectionStrings:Phones.ProviderName %>" 
            SelectCommand="SELECT [PhoneName], [AvgOfRating] FROM [FullAverageRating]">
        </asp:SqlDataSource>
    </p>
    <p>
        The Table above and the diagram below shows Average ratings of Phones by Users</p>
    <p>
        <asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource2">
            <Series>
                <asp:Series ChartType="Pie" Name="Series1" XValueMember="PhoneName" 
                    YValueMembers="AvgOfRating">
                </asp:Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </ChartAreas>
        </asp:Chart>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:Phones %>" 
            ProviderName="<%$ ConnectionStrings:Phones.ProviderName %>" 
            SelectCommand="SELECT [PhoneName], [AvgOfRating] FROM [FullAverageRating] WHERE ([AvgOfRating] &gt; ?)">
            <SelectParameters>
                <asp:Parameter DefaultValue="0" Name="AvgOfRating" Type="Double" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
</asp:Content>
